package Chuong03;

import java.awt.Color;
import java.awt.Graphics;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class Bai01 extends JPanel{
	
	public void paintComponent(Graphics g){
		super.paintComponent(g);
		for (int count = 0; count <100; count++){
			g.setColor(new Color((float) Math.random(),(float) Math.random(),(float) Math.random()));
			g.drawLine((int) (Math.random()*400), (int) (Math.random()*400), (int) (Math.random()*400), (int) (Math.random()*400));
		}
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		JFrame f = new JFrame("Chuong03_01");
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		Bai01 panel = new Bai01();
		f.add(panel);
		f.setSize(400, 400);
		f.setVisible(true);

	}

}
